package com.nuhu.controller;

import com.nuhu.pojo.ComplaintRecord;
import com.nuhu.pojo.Result;
import com.nuhu.pojo.User;
import com.nuhu.pojo.Worker;
import com.nuhu.service.admin_searchUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
public class admin_searchUserController {
    @Autowired
    private admin_searchUserService userService;
    @GetMapping("/search")
    public User searchUser(@RequestParam("phoneNumber") String phoneNumber) {
        return userService.getUserByPhoneNumber(phoneNumber);
    }


    @GetMapping("/AllBannedUser")
    @ResponseBody
    public List<User> getBannedUser(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int size) {
        System.out.println("6666");
        return userService.getBannedUser(page, size);
    }


    @GetMapping("/updateBan")
    public User updateBan(@RequestParam("phoneNumber") String phoneNumber) {
        return userService.updateBan(phoneNumber);
    }

    @GetMapping("/AllFanKui")
    @ResponseBody
    public List<ComplaintRecord> getFanKui(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int size) {
        System.out.println("6666");
        return userService.getFanKui(page, size);
    }
}
